<template>
   <div class="category-container">
     <nav-bar>
        <div slot="center">图书分类</div>
     </nav-bar>

     <div>
       <side-bar :categoryList="categoryList" :cid="cid"></side-bar>
     </div>
     <tab-bar></tab-bar>
   </div>
</template>

<script>
import NavBar from '../../components/nav-bar/Nav-Bar'
import SideBar from "./CategoryChild/SideBar";
import TabBar from "../../components/tabbar/TabBar";
import {getHomeData} from "../../api/home/home";

export default {
  name: "Category",
  components:{
    NavBar,
    SideBar,
    TabBar
  },
  data(){
    return{
      categoryList:[],
      cid:0
    }
  },
  mounted() {
    this.getCateGoryData()
  },
  methods:{
    // 获取分类数据
    async getCateGoryData(){
      const res = await getHomeData()
      if(res){
        this.categoryList = res.data.categories
      }
      // console.log(this.cid);
    }
  }
}
</script>

<style scoped lang="css">
.category-container{
  height: 100%;
}

</style>